#pragma once
#include <comdef.h>
#include <GdiPlus.h>
#include "skinimage.h"
using namespace Gdiplus;

class CSkinImageGdiplus : public CSkinImage
{
public:
    CSkinImageGdiplus( void );
    virtual ~CSkinImageGdiplus( void );

    SKIN_ATTRIBUTE_BEGIN()
    SKIN_ATTRIBUTE_STRING( _T( "src" ), m_imageSrc )
    SKIN_ATTRIBUTE_END()

public:
    static void InitGdiplus();
    static void UnInitGdiplus();
    static void SetSkinFolder( LPCTSTR skinFolder );
public:
    BOOL Load( LPCTSTR lpszFilePath );
    void UnLoad();
    void Draw( HDC hDC, const RECT& rc );
    void Draw( HDC hDC, const POINT& pt );
    void Draw( HDC hDC, int iDestX = 0, int iDestY = 0 );
    virtual void OnPaint( HDC hDC );
    virtual void NodeLoadComplete();
protected:
    BOOL IsLoaded();

private:
    static GdiplusStartupInput m_gdiplusStartupInput;
    static ULONG_PTR m_gdiplusToken;

private:
    Image* m_pGdiplusImg;
    CString m_imageSrc;
    static CString m_skinFolder;

};

